package com.esl.action.admin;

import java.util.Map;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Result;
import org.springframework.stereotype.Controller;

import com.esl.action.CommonAction;
import com.esl.dto.admin.Project_Dto;
import com.esl.model.admin.Project;

import com.esl.service.admin.ProjectManager;
import com.esl.service.admin.UserManager;
//@Controller
@Result(name = "tolist", location = "project?jump_url=list", type = "redirect")
public class ProjectAction extends CommonAction {

	private Project_Dto project_Dto = new Project_Dto();
	private ProjectManager projectManager;
	private UserManager userManager;
	private Map<String, Object> session = getSession();

	public String add() {
		projectManager.add(project_Dto.toProject(userManager
				.getCollectByString(project_Dto.getUsers())));
		return "list";
	}

	public String load() {

		setPageInfo_Dto(projectManager.load(Project.class, 1, 10, "", ""));
		return "success";
	}

	public String project() {
		return "project";
	}

	/*--------------------------------*/
	public Project_Dto getProject_Dto() {
		return project_Dto;
	}

	public void setProject_Dto(Project_Dto project_Dto) {
		this.project_Dto = project_Dto;
	}

	/*--------------------------------*/
	@Resource
	public void setProjectManager(ProjectManager projectManager) {
		this.projectManager = projectManager;
	}

	@Resource
	public void setUserManager(UserManager userManager) {
		this.userManager = userManager;
	}
}
